Refactor non-schema errors with thiserror - #7
Merged
Conversation
yslib
marked this pull request as ready for review
July 29, 2026 11:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
thiserror2 and replace handwrittenDisplay,Error, and mechanicalFromimplementations for all 20 non-schema error typesError::source()chains while keeping source-less domain errors source-lessJobSelectionErrordisplay from the canonical typed job selectorDisplayonly where formatting remains genuinely proceduralWhy
The error model had accumulated repetitive trait implementations across action, provider, planning, validation, configuration, link, and app-command modules. This refactor makes the type declarations the error contract while preserving the existing domain boundaries and runtime behavior.
The final cleanup also removes duplicate private command wrappers and makes unknown-job diagnostics use the same canonical
package:id,action:id, andlink:idspelling accepted by the CLI.Intentional API changes
Three public field representations change to work with
thiserrorwhile retaining concrete immediate-source downcasts:LinkError::UnsupportedSourceType.sourceis renamed to.pathbecausethiserrorreserves a field namedsourcefor error chainingConfigValidationError.kindchanges fromBox<ConfigValidationErrorKind>to directConfigValidationErrorKindConfigLoadError::Validation.sourcechanges fromBox<ConfigValidationError>to directConfigValidationErrorThe two direct errors are larger, so the affected validation, configuration, and app modules use documented
#[expect(clippy::result_large_err)]attributes. These expectations fail under strict Clippy if they become unnecessary.JobSelectionError::Unknownkeeps its public variant shape but changes its display from kind-specific prose such as “unknown action jobunknown” to the canonical form “unknown jobaction:unknown”.Impact
schema.rsare unchangedtransparenterrors or unintended public conversion APIs are introducedValidation
cargo fmt --all -- --checkcargo clippy --locked --all-targets --all-features -- -D warningscargo test --locked --all-targets --all-features— 315 top-level tests passedx86_64-pc-windows-gnuwith all targets and features#[from]attributes, zerotransparenterrors, unchangedschema.rs, ignored process docs, and a clean worktree